load("@prelude//toolchains/android/tools:build_rules.bzl", "buck_java_binary", "buck_java_library")
load("@prelude//utils:source_listing.bzl", "source_listing")

oncall("android_devxx")

source_listing()

buck_java_library(
    name = "plugin",
    srcs = glob(["*.java"]),
    resources = [
        ":javac-plugin",
    ],
    # This is required to ensure javac-plugin is placed in the same package as the code, i.e. com.facebook.buck.jvm.java.plugin
    resources_root = "../../../../../..",
    visibility = [
        "PUBLIC",
    ],
    deps = [
        "prelude//toolchains/android/src/com/facebook/buck/jvm/java/plugin/api:api",
        "prelude//toolchains/android/src/com/facebook/buck/util:util",
        "prelude//toolchains/android/third-party:guava",
        "prelude//toolchains/android/third-party:jsr305",
    ],
)

buck_java_binary(
    name = "javac-plugin",
    deps = [
        "prelude//toolchains/android/src/com/facebook/buck/jvm/java/abi/source:source",
        "prelude//toolchains/android/src/com/facebook/buck/jvm/java/plugin/adapter:adapter",
    ],
)
